Manipulating the Profile Data in a Color Profile Object
QuickDraw GX defines no structures or types for the profile data of a color profile object. For drawing or converting colors, most applications have no need to access or alter the data in a color profile object. For special needs, however, such as changing the type of match you want to perform, using a custom color-matching method, or inspecting the name of a profile, you can--with knowledge of the details of theCMProfile
structure--access and alter the profile data of an existing color profile object. Also, if your application is a calibration program that creates color profiles for devices, or if it is an imaging application that allows users to customize color profiles for specific uses, you need access to profile information in order to make or modify a color profile object.One way to do this is to use ColorSync functions to manipulate a ColorSync profile directly, and then use the QuickDraw GX function
GXNewColorProfile
to convert it to a color profile object. ColorSync profiles are commonly in the ColorSync profiles folder on the user's system, and ColorSync can provide you with a list of those profiles.More directly, you can call the
GXGetColorProfile
function to obtain the profile data for a given profile. Knowing the structure of a ColorSync color profile, you can then modify that information as needed, and return the altered data to the color profile object by calling theGXSetColorProfile
function.
Yet another approach is to directly modify the profile data of a color profile object
- Note
- If you alter the header of a ColorSync color profile to specify a particular color space in the
dataType
field, and then apply that profile to a color defined in terms of a different color space, QuickDraw GX ignores the new header data and specifies the color space implied by the color value you pass to the profile.![]()
in place, in QuickDraw GX memory. First, you call theGXLockColorProfile
function to prevent the profile data from being relocated, and then you callGXGetColorProfileStructure
to get a pointer to the profile data. After manipulating the data, you must callGXUnlockColorProfile
to release the
data for relocation. Remember that you cannot change the size of the profile data
with these calls, only its contents; if your manipulations require a change in the
size of the data, you must useGXGetColorProfile
andGXSetColorProfile
.
The
- IMPORTANT
- Memory-handling complications can occur with locked objects. Locking an object fragments the QuickDraw GX heap, which can result in lower performance. Furthermore, if a fragmented-memory condition occurs during a call, QuickDraw GX may unlock all objects and restart the call. Therefore, be careful about performing memory-intensive operations while there are locked objects in QuickDraw GX memory; they may become unlocked without warning.
![]()
GXNewColorProfile
function is described on page 4-79. TheGXGetColorProfile
function is described on page 4-88. TheGXSetColorProfile
function is described on page 4-89. TheGXLockColorProfile
function is described
on page 4-90. TheGXGetColorProfileStructure
function is described on page 4-92.TheGXUnlockColorProfile
function is described on page 4-91.